<template>
  <div class="container">
    <div ref="box">我是box</div>
    <hr />
    <ul>
      <li v-for="i in 4" :key="i" :ref="setDom">第{{ i }}LI</li>
    </ul>
  </div>
</template>

<script>
import {
  onBeforeMount,
  onMounted,
  reactive,
  toRefs,
  ref,
  computed,
  watch,
} from "vue";

export default {
  name: "App",
  setup() {
    const box = ref(null);
    onMounted(() => {
      console.log(box.value);
    });

    const domList = [];
    const setDom = (el) => {
      domList.push(el);
    };
    onMounted(() => {
      console.log(domList);
    });

    return { box, setDom };
  },
};
</script>
